﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.Battle;
using XMainClient.UI.UICommon;
using XUpdater;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02000E96 RID: 3734
	public class XCommand : XSingleton<XCommand>
	{
		// Token: 0x0600C74E RID: 51022 RVA: 0x002C382C File Offset: 0x002C1A2C
		public bool ProcessCommand(string command)
		{
			string[] array = command.Split(new char[]
			{
				' '
			});
			bool result = true;
			string text = array[0];
			switch(text)
			{
				case "testenter":
					if(XDebug.isLocalTest && array.Length > 1)
					{
						uint sceneid = uint.Parse(array[1]);
						XLoginDocument.singleton.ReqEnterScene(sceneid);
					}
					break;
				case "testpro":
					if (!XSingleton<XGame>.singleton.SyncMode && array.Length > 1)
					{
						uint promoteExperienceID = XSingleton<XProfessionSkillMgr>.singleton.GetPromoteExperienceID(int.Parse(array[1]));
						XSingleton<XDebug>.singleton.AddLog("GM Change PromoteExperienceID to ", promoteExperienceID.ToString(), null, null, null, null, XDebugColor.XDebug_None);
						XSingleton<XEntityMgr>.singleton.Player.OnTransform(promoteExperienceID);
					}
					break;
				case "inquirylevelseal":
					//zcg XLevelSealDocument specificDocument = XDocuments.GetSpecificDocument<XLevelSealDocument>(XLevelSealDocument.uuID);
					//zcg DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage(specificDocument.SealType.ToString());
					break;
				case "sendflower":
					ulong roleid = ulong.Parse(array[1]);
					uint count = uint.Parse(array[2]);
					RpcC2G_SendFlower rpcC2G_SendFlower = new RpcC2G_SendFlower();
					rpcC2G_SendFlower.oArg.roleid = roleid;
					rpcC2G_SendFlower.oArg.count = count;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2G_SendFlower);
					break;
				case "compose":
					if (array.Length > 1)
					{
						RpcC2G_UseItem rpcC2G_UseItem = new RpcC2G_UseItem();
						rpcC2G_UseItem.oArg.uid = (ulong)uint.Parse(array[1]);
						rpcC2G_UseItem.oArg.count = 1U;
						rpcC2G_UseItem.oArg.OpType = ItemUseMgr.GetItemUseValue(ItemUse.Composite);
						XSingleton<XClientNetwork>.singleton.Send(rpcC2G_UseItem);
					}
					break;
				case "guildhall":
					//zcg DlgBase<XGuildHallView, XGuildHallBehaviour>.singleton.SetVisibleWithAnimation(true, null);
					break;
				case "pandora":
					//zcg XSingleton<XPandoraSDKDocument>.singleton.PandoraOnJsonEvent(array[1]);
					break;
				case "changepro":
					RpcC2G_ChangeProfession rpcC2G_ChangeProfession = new RpcC2G_ChangeProfession();
					rpcC2G_ChangeProfession.oArg.pro = uint.Parse(array[1]);
					XSingleton<XClientNetwork>.singleton.Send(rpcC2G_ChangeProfession);
					break;
				case "invite":
					if (array.Length >= 2)
					{
						ulong[] array2 = null;
						if (array.Length >= 3)
						{
							array2 = new ulong[array.Length - 2];
							for (int i = 2; i < array.Length; i++)
							{
								array2[i - 2] = ulong.Parse(array[i]);
							}
						}
						//zcg XInvitationDocument specificDocument2 = XDocuments.GetSpecificDocument<XInvitationDocument>(XInvitationDocument.uuID);
						//zcg specificDocument2.SendOpenSysInvitation((XSysDefine)int.Parse(array[1]), array2);
					}
					break;
				case "sscale":
					if (array.Length == 2)
					{
						float num2 = float.Parse(array[1]);
						float num3 = 1136f * num2;
						float num4 = 640f * num2;
						Screen.SetResolution((int)num3, (int)num4, true);
					}
					break;
				case "attr":
					if (!XSingleton<XGame>.singleton.SyncMode)
					{
						if (array.Length >= 3)
						{
							int attrKey = int.Parse(array[1]);
							int num5 = int.Parse(array[2]);
							XEntity xentity;
							if (array.Length == 3)
							{
								xentity = XSingleton<XEntityMgr>.singleton.Player;
							}
							else
							{
								ulong id = ulong.Parse(array[3]);
								xentity = XSingleton<XEntityMgr>.singleton.GetEntity(id);
							}
							if (xentity != null)
							{
								XAttrChangeEventArgs xattrChangeEventArgs = new XAttrChangeEventArgs();
								xattrChangeEventArgs.AttrKey = (XAttributeDefine)attrKey;
								xattrChangeEventArgs.DeltaValue = (double)num5;
								xattrChangeEventArgs.Firer = xentity;
								XSingleton<XEventMgr>.singleton.FireEvent(xattrChangeEventArgs);
							}
						}
						break;
					}
					return SendGMCommandToServer(command);
					
				case "setminimapsize":
					//zcg DlgBase<BattleMain, BattleMainBehaviour>.singleton.IndicateHandler.SetMiniMapSize(new Vector2(float.Parse(array[1]), float.Parse(array[2])), (array.Length > 3) ? float.Parse(array[3]) :
					break;
				case "print":
					XSingleton<XDebug>.singleton.Print();
					break;
				case "blackwhite":
					XSingleton<XPostEffectMgr>.singleton.MakeEffectEnable(XPostEffect.BlackWhite, true);
					break;
				case "addfriend":
					ulong friendroleid = ulong.Parse(array[1]);
					RpcC2M_AddFriendNew rpcC2M_AddFriendNew = new RpcC2M_AddFriendNew();
					rpcC2M_AddFriendNew.oArg.friendroleid = friendroleid;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_AddFriendNew);
					break;
				case "officialversionserver":
					if (File.Exists(Path.Combine(Application.persistentDataPath, "TEST_VERSION")))
					{
						File.Delete(Path.Combine(Application.persistentDataPath, "TEST_VERSION"));
					}
					break;
				case "clientaddpk":
					RpcC2M_PkReqC2M rpcC2M_PkReqC2M = new RpcC2M_PkReqC2M();
					rpcC2M_PkReqC2M.oArg.type = PkReqType.PKREQ_ADDPK;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_PkReqC2M);
					break;
				case "close":
					XSingleton<XClientNetwork>.singleton.Close(NetErrCode.Net_NoError);
					break;
				case "gyrooff":
					XSingleton<XGyroscope>.singleton.Enabled = false;
					break;
				case "unloadbundle":
					XSingleton<XUpdater.XUpdater>.singleton.ABManager.UnloadNotUsedLoader();
					break;
				case "targetframe":
					if (Application.targetFrameRate != XShell.TargetFrame)
					{
						Application.targetFrameRate = XShell.TargetFrame;
					}
					else
					{
						Application.targetFrameRate = -1;
					}
					break;
				case "levelover":
					XSingleton<XScene>.singleton.ReqLeaveScene();
					break;
				case "testskill":
					XSingleton<XSkillEffectMgr>.singleton.TestSkillTable();
					break;
				case "suit":
					int suitID = int.Parse(array[1]);
					//zcg XFashionDocument specificDocument3 = XDocuments.GetSpecificDocument<XFashionDocument>(XFashionDocument.uuID);
					//zcg specificDocument3.EquipSuit(suitID);
					break;
				case "listbuff":
					if (!XSingleton<XGame>.singleton.SyncMode)
					{
						ulong id2;
						if (array.Length >= 2)
						{
							id2 = ulong.Parse(array[1]);
						}
						else
						{
							id2 = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
						}
						XEntity entity = XSingleton<XEntityMgr>.singleton.GetEntity(id2);
						if (entity != null && entity.Buffs != null)
						{
							XSingleton<XCommon>.singleton.CleanStringCombine();
							StringBuilder sharedStringBuilder = XSingleton<XCommon>.singleton.GetSharedStringBuilder();
							List<XBuff> buffList = entity.Buffs.BuffList;
							for (int j = 0; j < buffList.Count; j++)
							{
								sharedStringBuilder.Append("[").Append(buffList[j].ID).Append(":").Append(buffList[j].Level).Append("]");
							}
							DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage(sharedStringBuilder.ToString());
						}
						break;
					}
					return SendGMCommandToServer(command);
				case "addblack":
					RpcC2M_AddBlackListNew rpcC2M_AddBlackListNew = new RpcC2M_AddBlackListNew();
					rpcC2M_AddBlackListNew.oArg.otherroleid = ulong.Parse(array[1]);
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_AddBlackListNew);
					break;
				case "clearguildcollectCD":
					//zcg XGuildCollectDocument specificDocument4 = XDocuments.GetSpecificDocument<XGuildCollectDocument>(XGuildCollectDocument.uuID);
					//zcg specificDocument4.LotteryCDInfo.Clear();
					break;
				case "gausblur":
					XSingleton<XPostEffectMgr>.singleton.MakeEffectEnable(XPostEffect.GausBlur, true);
					break;
				case "free3g":
					//zcg AdditionRemindDocument specificDocument5 = XDocuments.GetSpecificDocument<AdditionRemindDocument>(AdditionRemindDocument.uuID);
					//zcg specificDocument5.gm_is_3g = true;
					break;
				case "randomfriend":
					string match = array[1];
					RpcC2M_RandomFriendWaitListNew rpcC2M_RandomFriendWaitListNew = new RpcC2M_RandomFriendWaitListNew();
					rpcC2M_RandomFriendWaitListNew.oArg.match = match;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_RandomFriendWaitListNew);
					break;
				case "quit":
					Application.Quit();
					break;
				case "cinfo":
					XFileLog._OpenCustomBtn = !XFileLog._OpenCustomBtn;
					break;
				case "buff":
					if (XSingleton<XGame>.singleton.SyncMode)
					{
						return SendGMCommandToServer(command);
					}
					XBuffAddEventArgs xbuffAddEventArgs = XEventPool<XBuffAddEventArgs>.GetEvent();
					if (array.Length >= 3)
					{
						xbuffAddEventArgs.xBuffDesc.BuffID = int.Parse(array[1]);
						xbuffAddEventArgs.xBuffDesc.BuffLevel = int.Parse(array[2]);
						xbuffAddEventArgs.xBuffDesc.CasterID = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
						ulong id3;
						if (array.Length >= 4)
						{
							if (array[3].StartsWith("t"))
							{
								xbuffAddEventArgs.xBuffDesc.EffectTime = float.Parse(array[3].Substring(1));
								if (array.Length >= 5)
								{
									id3 = ulong.Parse(array[4]);
								}
								else
								{
									id3 = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
								}
							}
							else
							{
								id3 = ulong.Parse(array[3]);
							}
						}
						else
						{
							id3 = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
						}
						XEntity entity2 = XSingleton<XEntityMgr>.singleton.GetEntity(id3);
						if (entity2 != null)
						{
							xbuffAddEventArgs.Firer = entity2;
							XSingleton<XEventMgr>.singleton.FireEvent(xbuffAddEventArgs);
							xbuffAddEventArgs = null;
						}
					}
					if (xbuffAddEventArgs != null)
					{
						xbuffAddEventArgs.Recycle();
					}
					break;
				case "gyro":
					float num6 = 0f;
					float num7 = 0f;
					float num8 = 0f;
					if (array.Length > 1)
					{
						float.TryParse(array[1], out num6);
					}
					if (array.Length > 2)
					{
						float.TryParse(array[2], out num7);
					}
					if (array.Length > 3)
					{
						float.TryParse(array[3], out num8);
					}
					if (num6 == 0f)
					{
						num6 = XSingleton<XGyroscope>.singleton.Scale;
					}
					if (num7 == 0f)
					{
						num7 = XSingleton<XGyroscope>.singleton.DeadZone;
					}
					if (num8 == 0f)
					{
						num8 = XSingleton<XGyroscope>.singleton.Frequency;
					}
					XSingleton<XGyroscope>.singleton.Set(num6, num8, num7);
					break;
				case "equipall":
					XBagDocument xbagDoc = XSingleton<XGame>.singleton.Doc.XBagDoc;
					xbagDoc.GetAllEquip();
					break;
				case "battleqte":
					//zcg DlgBase<BattleQTEDlg, BattleQTEDlgBehaviour>.singleton.SetStatus(QteUIType.Abnormal, true);
					break;
				case "sweep":
					RpcC2G_Sweep rpcC2G_Sweep = new RpcC2G_Sweep();
					rpcC2G_Sweep.oArg.sceneID = uint.Parse(array[1]);
					rpcC2G_Sweep.oArg.count = uint.Parse(array[2]);
					XSingleton<XClientNetwork>.singleton.Send(rpcC2G_Sweep);
					break;
				case "getwindow":
					string str = array[1];
					string childName = array[2];
					GameObject gameObject = GameObject.Find("UIRoot/" + str + "(Clone)");
					if (gameObject == null)
					{
						DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage("dlg not found!");
						return true;
					}
					Transform transform = XSingleton<UiUtility>.singleton.FindChild(gameObject.transform, childName);
					if (transform == null)
					{
						DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage("window not found!");
						return true;
					}
					DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage(string.Concat(new object[]
					{
								"target window position: (",
								transform.localPosition.x,
								",",
								transform.localPosition.y,
								",",
								transform.localPosition.z,
								")"
					}));
					IXUISprite ixuisprite = transform.GetComponent("XUISprite") as IXUISprite;
					if (ixuisprite != null)
					{
						DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage(string.Concat(new object[]
						{
									"target window size: ",
									ixuisprite.spriteWidth,
									"x",
									ixuisprite.spriteHeight
						}));
					}
					break;
				case "getdesall":
					//zcg
					// 							XDesignationDocument specificDocument6 = XDocuments.GetSpecificDocument<XDesignationDocument>(XDesignationDocument.uuID);
					// 							for (int k = 1; k < specificDocument6._DesignationTable.Table.Length; k++)
					// 							{
					// 								RpcC2G_GMCommand rpcC2G_GMCommand = new RpcC2G_GMCommand();
					// 								rpcC2G_GMCommand.oArg.cmd = string.Format("getdesignation {0}", specificDocument6._DesignationTable.Table[k].ID);
					// 								XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GMCommand);
					// 							}
					break;
				case "generatefiles":
					int num9 = 0;
					int.TryParse(array[1], out num9);
					//zcg XSingleton<XChatIFlyMgr>.singleton.GenerateAudioFiles(num9);
					break;
				case "queryrolestate":
					PtcC2M_RoleStateReportNew ptcC2M_RoleStateReportNew = new PtcC2M_RoleStateReportNew();
					for (int l = 0; l < array.Length; l++)
					{
						ptcC2M_RoleStateReportNew.Data.roleid.Add(ulong.Parse(array[l]));
					}
					XSingleton<XClientNetwork>.singleton.Send(ptcC2M_RoleStateReportNew);
					break;
				case "opengamezone":
					if (DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible())
					{
						DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.uiBehaviour.GetSysButton(XSysDefine.XSys_GameCommunity).SetVisible(true);
						DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.uiBehaviour.m_SysListV2.Refresh();
					}
					break;
				case "buildlog":
					XSingleton<XGame>.singleton.ShowBuildLog = !XSingleton<XGame>.singleton.ShowBuildLog;
					break;
				case "damage":
					if (XSingleton<XGame>.singleton.SyncMode)
					{
						return SendGMCommandToServer(command);
					}
					if (array.Length >= 2)
					{
						if (array[1] == "start")
						{
							if (array.Length >= 3)
							{
								float num10 = float.Parse(array[2]);
							}
							XSingleton<XAttributeMgr>.singleton.XPlayerData.TogglePrintDamage(true);
						}
						else
						{
							if (array[1] == "end")
							{
								XSingleton<XAttributeMgr>.singleton.XPlayerData.TogglePrintDamage(false);
							}
						}
					}
					break;
				case "record":
					int num11 = int.Parse(array[1]);
					XDebug.RecordChannel channel = (XDebug.RecordChannel)int.Parse(array[2]);
					if (num11 == 1)
					{
						XSingleton<XDebug>.singleton.StartRecord(channel);
					}
					else
					{
						if (num11 == 0)
						{
							XSingleton<XDebug>.singleton.EndRecord();
						}
						else
						{
							if (num11 == 2)
							{
								XSingleton<XDebug>.singleton.ClearRecord();
							}
						}
					}
					break;
				case "listattr":
					if (!XSingleton<XGame>.singleton.SyncMode)
					{
						if (array.Length >= 2)
						{
							ulong roleid1 = ulong.Parse(array[1]);
							if (roleid1 == 0UL)
							{
								roleid1 = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
							}
							XEntity entity3 = XSingleton<XEntityMgr>.singleton.GetEntity(roleid1);
							if (entity3 != null && entity3.Attributes != null)
							{
								List<int> list = ListPool<int>.Get();
								for (int m = 2; m < array.Length; m++)
								{
									list.Add(int.Parse(array[m]));
								}
								if (list.Count == 0)
								{
									for (int n = 1; n < XAttributeCommon.AttrCount; n++)
									{
										list.Add(n);
										list.Add(n + XAttributeCommon.PercentStart);
										list.Add(n + XAttributeCommon.TotalStart);
									}
								}
								XSingleton<XCommon>.singleton.CleanStringCombine();
								StringBuilder sharedStringBuilder2 = XSingleton<XCommon>.singleton.GetSharedStringBuilder();
								for (int num13 = 0; num13 < list.Count; num13++)
								{
									double attr = entity3.Attributes.GetAttr((XAttributeDefine)list[num13]);
									if (Math.Abs(attr) >= 0.0001)
									{
										sharedStringBuilder2.Append("[").Append(list[num13]).Append(": ").Append(attr.ToString("F2")).Append("]\n");
									}
								}
								DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage(sharedStringBuilder2.ToString());
							}
						}
						break;
					}
					return SendGMCommandToServer(command);
				case "TopTask":
					if (array.Length >= 2)
					{
						XTaskDocument specificDocument7 = XDocuments.GetSpecificDocument<XTaskDocument>(XTaskDocument.uuID);
						specificDocument7.SetHighestPriorityTask(uint.Parse(array[1]));
					}
					break;
				case "hide":
					if (array.Length > 1)
					{
						GameObject[] array3 = (GameObject[])Resources.FindObjectsOfTypeAll(typeof(GameObject));
						for (int num14 = 0; num14 < array3.Length; num14++)
						{
							if (array3[num14].name == array[1])
							{
								array3[num14].SetActive(!array3[num14].activeSelf);
							}
						}
					}
					break;
				case "tutorialend":
					PtcC2G_UpdateTutorial ptcC2G_UpdateTutorial = new PtcC2G_UpdateTutorial();
					for (int num15 = 1; num15 < array.Length; num15++)
					{
						ptcC2G_UpdateTutorial.Data.tutorialID = uint.Parse(array[num15]);
						XSingleton<XClientNetwork>.singleton.Send(ptcC2G_UpdateTutorial);
					}
					break;
				case "allskill":
					int num16 = (int)XSingleton<XGame>.singleton.Doc.XBagDoc.GetSkillPointCount(false);
					if (num16 < 300)
					{
						this.ProcessCommand("item 2 800");
						this.ProcessCommand("item 5 800");
					}
					this.SkillLearn(null);
					break;
				case "guildencourage":
					uint count2 = 0U;
					int num17 = 1;
					if (array.Length > 1)
					{
						uint.TryParse(array[1], out count2);
					}
					if (array.Length > 2)
					{
						int.TryParse(array[2], out num17);
					}
					for (int num18 = 0; num18 < num17; num18++)
					{
						RpcC2M_WorldBossGuildAddAttr rpcC2M_WorldBossGuildAddAttr = new RpcC2M_WorldBossGuildAddAttr();
						rpcC2M_WorldBossGuildAddAttr.oArg.count = count2;
						XSingleton<XClientNetwork>.singleton.Send(rpcC2M_WorldBossGuildAddAttr);
					}
					break;
				case "levelslot":
					if (array.Length == 3)
					{
						RpcC2G_LevelUpSlotAttr rpcC2G_LevelUpSlotAttr = new RpcC2G_LevelUpSlotAttr();
						rpcC2G_LevelUpSlotAttr.oArg.slot = uint.Parse(array[1]);
						rpcC2G_LevelUpSlotAttr.oArg.count = uint.Parse(array[2]);
						XSingleton<XClientNetwork>.singleton.Send(rpcC2G_LevelUpSlotAttr);
					}
					break;
				case "freetime":
					int logintime = int.Parse(array[1]);
					//zcg AdditionRemindDocument specificDocument8 = XDocuments.GetSpecificDocument<AdditionRemindDocument>(AdditionRemindDocument.uuID);
					//zcg specificDocument8.LOGINTIME = logintime;
					break;
				case "buy":
					RpcC2G_BuyGoldAndFatigue rpcC2G_BuyGoldAndFatigue = new RpcC2G_BuyGoldAndFatigue();
					rpcC2G_BuyGoldAndFatigue.oArg.fatigueID = uint.Parse(array[1]);
					XSingleton<XClientNetwork>.singleton.Send(rpcC2G_BuyGoldAndFatigue);
					break;
				case "hudnum":
					XHUDComponent._Max_UI_UpdateCount_PreFrame = int.Parse(array[1]);
					break;
				case "setxy":
					Screen.SetResolution(int.Parse(array[1]), int.Parse(array[2]), true);
					break;
				case "showblacklist":
					PtcC2M_BlackListReportNew proto = new PtcC2M_BlackListReportNew();
					XSingleton<XClientNetwork>.singleton.Send(proto);
					break;
				case "removeblack":
					RpcC2M_RemoveBlackListNew rpcC2M_RemoveBlackListNew = new RpcC2M_RemoveBlackListNew();
					rpcC2M_RemoveBlackListNew.oArg.otherroleid = ulong.Parse(array[1]);
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_RemoveBlackListNew);
					break;
				case "showsystemui":
					if (array.Length == 2)
					{
						XSingleton<XGameSysMgr>.singleton.OpenSystem((XSysDefine)int.Parse(array[1]), 0UL);
					}
					break;
				case "inquirytutorial":
					int num19 = 0;
					int num20 = 10;
					StringBuilder stringBuilder = new StringBuilder();
					stringBuilder.Append((num19 + 1).ToString("000") + "-" + (num19 + num20).ToString("000") + ": ");
					for (int num21 = 0; num21 < XSingleton<XTutorialMgr>.singleton.TutorialBitsArray.Length; num21++)
					{
						byte b = XSingleton<XTutorialMgr>.singleton.TutorialBitsArray[num21];
						for (int num22 = 0; num22 < 8; num22++)
						{
							if (((int)b & 1 << num22) == 0)
							{
								stringBuilder.Append("0");
							}
							else
							{
								stringBuilder.Append("1");
							}
							num19++;
							if (num19 % num20 == 0)
							{
								DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage(stringBuilder.ToString());
								stringBuilder = new StringBuilder();
								stringBuilder.Append((num19 + 1).ToString("000") + " " + (num19 + num20).ToString("000") + ":");
							}
						}
					}
					if (num19 % num20 != 0)
					{
						DlgBase<DemoUI, DemoUIBehaviour>.singleton.AddMessage(stringBuilder.ToString());
					}
					break;
				case "hideT":
					if (array.Length == 2)
					{
						int num23 = int.Parse(array[1]);
						GameObject gameObject2 = GameObject.Find("Scene/Terrain");
						if (gameObject2 != null)
						{
							this.terrain = gameObject2;
						}
						if (this.terrain != null)
						{
							this.terrain.SetActive(num23 > 0);
						}
					}
					break;
				case "unloadassets":
					Resources.UnloadUnusedAssets();
					break;
				case "bubble":
					XBubbleEventArgs @event = XEventPool<XBubbleEventArgs>.GetEvent();
					if (array.Length >= 2)
					{
						@event.bubbletext = array[1];
					}
					if (array.Length >= 3)
					{
						@event.existtime = float.Parse(array[2]);
					}
					if (array.Length >= 4)
					{
						@event.Firer = XSingleton<XEntityMgr>.singleton.GetEntity(ulong.Parse(array[3]));
						@event.speaker = XSingleton<XEntityMgr>.singleton.GetEntity(ulong.Parse(array[3])).Name;
					}
					else
					{
						@event.Firer = XSingleton<XEntityMgr>.singleton.Player;
						@event.speaker = XSingleton<XEntityMgr>.singleton.Player.Name;
					}
					XBubbleComponent xbubbleComponent = @event.Firer.GetXComponent(XBubbleComponent.uuID) as XBubbleComponent;
					if (xbubbleComponent == null)
					{
						XSingleton<XComponentMgr>.singleton.CreateComponent(@event.Firer, XBubbleComponent.uuID);
					}
					XSingleton<XEventMgr>.singleton.FireEvent(@event);
					break;
				case "themeopen":
					//zcg DlgBase<XThemeActivityView, XThemeActivityBehaviour>.singleton.debug = true;
					//zcg DlgBase<XThemeActivityView, XThemeActivityBehaviour>.singleton.SetVisibleWithAnimation(true, null);
					break;
				case "testversionserver":
					using (new StreamWriter(Path.Combine(Application.persistentDataPath, "TEST_VERSION")))
					{
						XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SetNoBackupFlag(Path.Combine(Application.persistentDataPath, "TEST_VERSION"));
					}
					break;
				case "tutorialendcur":
					XSingleton<XTutorialMgr>.singleton.SkipCurrentTutorial(false);
					break;
				case "notice":
					if (array.Length >= 2)
					{
						ulong[] array4 = null;
						if (array.Length >= 3)
						{
							array4 = new ulong[array.Length - 2];
							for (int num24 = 2; num24 < array.Length; num24++)
							{
								array4[num24 - 2] = ulong.Parse(array[num24]);
							}
						}
						//zcg XInvitationDocument specificDocument9 = XDocuments.GetSpecificDocument<XInvitationDocument>(XInvitationDocument.uuID);
						//zcg specificDocument9.SendOpenSysInvitation((NoticeType)int.Parse(array[1]), array4);
					}
					break;
				case "reconnect":
					XSingleton<XClientNetwork>.singleton.XConnect.ReconnectionEnabled = true;
					break;
				case "team":
					//zcg DlgBase<XTeamView, TabDlgBehaviour>.singleton.ShowTeamView();
					break;
				case "chat":
					ulong item = ulong.Parse(array[1]);
					string info = array[2];
					RpcC2M_chat rpcC2M_chat = new RpcC2M_chat();
					rpcC2M_chat.oArg.chatinfo = new KKSG.ChatInfo();
					rpcC2M_chat.oArg.chatinfo.channel = 3U;
					rpcC2M_chat.oArg.chatinfo.info = info;
					rpcC2M_chat.oArg.chatinfo.dest = new ChatDest();
					rpcC2M_chat.oArg.chatinfo.dest.roleid.Add(item);
					for (int num25 = 0; num25 < 20; num25++)
					{
						XSingleton<XClientNetwork>.singleton.Send(rpcC2M_chat);
					}
					break;
				case "custombattle":
					uint op = 0U;
					ulong uid = 0UL;
					uint configid = 0U;
					if (array.Length > 1)
					{
						uint.TryParse(array[1], out op);
					}
					RpcC2M_CustomBattleOp rpcC2M_CustomBattleOp = new RpcC2M_CustomBattleOp();
					rpcC2M_CustomBattleOp.oArg.op = (CustomBattleOp)op;
					if (array.Length > 2)
					{
						ulong.TryParse(array[2], out uid);
					}
					if (rpcC2M_CustomBattleOp.oArg.op == CustomBattleOp.CustomBattle_Create)
					{
						if (array.Length > 2)
						{
							uint.TryParse(array[2], out configid);
						}
					}
					rpcC2M_CustomBattleOp.oArg.uid = uid;
					rpcC2M_CustomBattleOp.oArg.config = new CustomBattleConfig();
					rpcC2M_CustomBattleOp.oArg.config.configid = configid;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_CustomBattleOp);
					break;
				case "showflowerpage":
					ulong roleid2 = ulong.Parse(array[1]);
					RpcC2M_ShowFlowerPageNew rpcC2M_ShowFlowerPageNew = new RpcC2M_ShowFlowerPageNew();
					rpcC2M_ShowFlowerPageNew.oArg.roleid = roleid2;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_ShowFlowerPageNew);
					break;
				case "enable":
					if (array.Length >= 3)
					{
						int num26 = int.Parse(array[1]);
						int num27 = int.Parse(array[2]);
						switch (num26)
						{
							case 1:
								XFxMgr.EmptyFx = (num27 != 0);
								break;
							case 2:
								XSingleton<XAudioMgr>.singleton.hasSound = (num27 != 0);
								break;
							case 3:
								XStateMachine._EnableAtor = (num27 != 0);
								break;
							case 4:
								{
									if (num27 != 0)
									{
										XSingleton<XScene>.singleton.GameCamera.SetReplaceCameraShader(ShaderManager._color);
									}
									else
									{
										XSingleton<XScene>.singleton.GameCamera.SetReplaceCameraShader(null);
									}
									break;
								}
						}
					}
					break;
				case "aitree":
					XRole xrole = XSingleton<XEntityMgr>.singleton.CreateRole(XSingleton<XAttributeMgr>.singleton.XPlayerData, XSingleton<XEntityMgr>.singleton.Player.MoveObj.Position, Quaternion.identity, false, false);
					XMount xmount = XSingleton<XEntityMgr>.singleton.CreateMount(12014U, xrole, true);
					XRole entity4 = XSingleton<XEntityMgr>.singleton.CreateRole(XSingleton<XAttributeMgr>.singleton.XPlayerData, XSingleton<XEntityMgr>.singleton.Player.MoveObj.Position, Quaternion.identity, false, false);
					bool flag69 = xrole.Mount.MountCopilot(entity4);
					XSingleton<XDebug>.singleton.AddLog(flag69.ToString(), null, null, null, null, null, XDebugColor.XDebug_None);
					string value = XSingleton<XGlobalConfig>.singleton.GetValue("WeddingPatrolAITree");
					if (xrole.AI == null)
					{
						xrole.AI = (XSingleton<XComponentMgr>.singleton.CreateComponent(xrole, XAIComponent.uuID) as XAIComponent);
						xrole.AI.InitVariables();
						xrole.AI.SetFixVariables();
					}
					if (xrole.Nav == null)
					{
						xrole.Nav = (XSingleton<XComponentMgr>.singleton.CreateComponent(xrole, XNavigationComponent.uuID) as XNavigationComponent);
						xrole.Nav.Active();
					}
					xrole.AI.Patrol.InitNavPath(XSingleton<XGlobalConfig>.singleton.GetValue("WeddingPatrolPath"), XPatrol.PathType.PT_NORMAL);
					xrole.AI.SetBehaviorTree(value);
					break;
				case "killclientall":
					if (array.Length > 1)
					{
						XSingleton<XAIOtherActions>.singleton.TickKillAll(array[1]);
					}
					else
					{
						XSingleton<XLevelSpawnMgr>.singleton.KillAllMonster();
					}
					break;
				case "tea":
					break;
				case "death":
					XSingleton<XEntityMgr>.singleton.Player.Attributes.ForceDeath();
					break;
				case "bundlelog":
					AssetBundleManager.enableLog = !AssetBundleManager.enableLog;
					XFileLog._logBundleOpen = !XFileLog._logBundleOpen;
					break;
				case "guildcollectitem":
					for (int num28 = 8000; num28 < 8016; num28++)
					{
						this.ProcessCommand(string.Format("item {0} 20", num28));
					}
					break;
				case "titleitem":
					this.ProcessCommand("item 2097 1");
					this.ProcessCommand("item 301 30");
					this.ProcessCommand("item 302 30");
					this.ProcessCommand("item 303 30");
					this.ProcessCommand("item 304 30");
					break;
				case "anim":
					XAnimator.debug = !XAnimator.debug;
					break;
				case "tutorialendall":
					XSingleton<XTutorialMgr>.singleton.CloseAllTutorial();
					this.ProcessCommand("tutorialendcurall");
					break;
				case "allpk":
					//zcg DlgBase<CustomBattleView, TabDlgBehaviour>.singleton.ShowWorkGameSystem(XSysDefine.XSys_CustomBattle_BountyMode);
					break;
				case "IgnoreServerOpenDay":
					//zcg XActivityDocument specificDocument10 = XDocuments.GetSpecificDocument<XActivityDocument>(XActivityDocument.uuID);
					//zcg specificDocument10.ServerOpenDay = 1000;
					break;
				case "mzj":
					//zcg DlgBase<XOperatingActivityView, XOperatingActivityBehaviour>.singleton.Show(XSysDefine.XSys_CampDuel, true);
					break;
				case "stop":
					if (array.Length > 1)
					{
						int num29 = 0;
						int.TryParse(array[1], out num29);
						int num30 = num29;
						if (num30 != 0)
						{
							if (num30 == 1)
							{
								GameObject gameObject3 = GameObject.Find("UIRoot(Clone)");
								if (gameObject3 != null)
								{
									gameObject3.SetActive(false);
								}
								gameObject3 = GameObject.Find("HpbarRoot(Clone)");
								if (gameObject3 != null)
								{
									gameObject3.SetActive(false);
								}
								gameObject3 = GameObject.Find("NpcHpbarRoot");
								if (gameObject3 != null)
								{
									gameObject3.SetActive(false);
								}
							}
						}
						else
						{

#if UNITY_5
									GameObject gameObject4 = GameObject.Find("XGamePoint");
#else
							GameObject gameObject4 = GameObject.Find("HeroWorldGame");
#endif
							if (gameObject4 != null)
							{
								gameObject4.SetActive(false);
							}
						}
					}
					break;
				case "mzj0":
					XSingleton<XInput>.singleton.LastNpc = XSingleton<XEntityMgr>.singleton.GetNpc(165U);
					break;
				case "openurl":
					if (array.Length > 1)
					{
						Application.OpenURL(array[1]);
					}
					break;
				case "mzj1":
					XSingleton<XInput>.singleton.LastNpc = XSingleton<XEntityMgr>.singleton.GetNpc(17U);
					break;
				case "airuntime":
					int num31 = int.Parse(array[1]);
					XAIComponent.UseRunTime = (num31 != 0);
					XSingleton<XResourceLoaderMgr>.singleton.DelayLoad = XAIComponent.UseRunTime;
					break;
				case "mzj2":
					//zcg XCampDuelDocument.Doc.campID = 2;
					break;
				case "setsound":
					XSingleton<XAudioMgr>.singleton.hasSound = !XSingleton<XAudioMgr>.singleton.hasSound;
					break;
				case "comps":
					XSingleton<XComponentMgr>.singleton.PrintAllComponent();
					break;
				case "kiss":
					XSingleton<XCutScene>.singleton.Start("CutScene/argent_kiss", true, true);
					break;
				case "authinvalid":
					XSingleton<XLoginDocument>.singleton.OnAuthorizationSignOut("test");
					break;
				case "hud":
					XHUDComponent.processHud = !XHUDComponent.processHud;
					break;
				case "removefriend":
					ulong friendroleid2 = ulong.Parse(array[1]);
					RpcC2M_RemoveFriendNew rpcC2M_RemoveFriendNew = new RpcC2M_RemoveFriendNew();
					rpcC2M_RemoveFriendNew.oArg.friendroleid = friendroleid2;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_RemoveFriendNew);
					break;
				case "getappearance":
					ulong roleid3 = ulong.Parse(array[1]);
					int mask = int.Parse(array[2]);
					RpcC2M_GetUnitAppearanceNew rpcC2M_GetUnitAppearanceNew = new RpcC2M_GetUnitAppearanceNew();
					rpcC2M_GetUnitAppearanceNew.oArg.roleid = roleid3;
					rpcC2M_GetUnitAppearanceNew.oArg.mask = mask;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_GetUnitAppearanceNew);
					break;
				case "mob":
					uint id4 = uint.Parse(array[1]);
					Quaternion rotation = Quaternion.Euler(0f, 0f, 0f);
					XEntity xentity2 = XSingleton<XEntityMgr>.singleton.CreateEntity(id4, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position, rotation, true, uint.MaxValue);
					break;
				case "uiopt":
					if (array.Length >= 4)
					{
						int num32 = int.Parse(array[1]);
						int num33 = int.Parse(array[2]);
						int num34 = int.Parse(array[3]);
						XSingleton<XGameUI>.singleton.SetUIOptOption(num32 != 0, num33 != 0, num34 != 0, true);
					}
					break;
				case "guilddragon":
					//zcg DlgBase<XGuildDragonView, XGuildDragonBehaviour>.singleton.ShowGuildBossView();
					break;
				case "niube":
					break;
				case "hailong":
					List<string> list2 = new List<string>
						{
							"item 85 100",
							"item 40607 1",
							"item 40608 1",
							"item 40609 1",
							"item 2503001 1",
							"item 2503002 1",
							"item 2503003 1",
							"item 2503004 1",
							"item 2503011 1",
							"item 2503012 1",
							"item 2503013 1",
							"item 2503021 1",
							"item 2503022 1",
							"item 2503031 1",
							"item 2503032 1",
							"item 1000106 10",
							"item 1000206 10",
							"item 1000306 10",
							"item 1000406 10",
							"item 1001106 10",
							"item 1002106 10",
							"item 1003106 10",
							"item 7 100000000"
						};
					XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
					uint typeID = player.TypeID;
					switch (typeID % 10U)
					{
						case 1U:
							list2.Add("item 140600 1");
							list2.Add("item 140601 1");
							list2.Add("item 140602 1");
							list2.Add("item 140603 1");
							list2.Add("item 140604 1");
							list2.Add("item 140605 1");
							list2.Add("item 140606 1");
							break;
						case 2U:
							list2.Add("item 240600 1");
							list2.Add("item 240601 1");
							list2.Add("item 240602 1");
							list2.Add("item 240603 1");
							list2.Add("item 240604 1");
							list2.Add("item 240605 1");
							list2.Add("item 240606 1");
							break;
						case 3U:
							list2.Add("item 340600 1");
							list2.Add("item 340601 1");
							list2.Add("item 340602 1");
							list2.Add("item 340603 1");
							list2.Add("item 340604 1");
							list2.Add("item 340605 1");
							list2.Add("item 340606 1");
							break;
						case 4U:
							list2.Add("item 440600 1");
							list2.Add("item 440601 1");
							list2.Add("item 440602 1");
							list2.Add("item 440603 1");
							list2.Add("item 440604 1");
							list2.Add("item 440605 1");
							list2.Add("item 440606 1");
							break;
						case 5U:
							list2.Add("item 540600 1");
							list2.Add("item 540601 1");
							list2.Add("item 540602 1");
							list2.Add("item 540603 1");
							list2.Add("item 540604 1");
							list2.Add("item 540605 1");
							list2.Add("item 540606 1");
							break;
					}
					foreach (string command2 in list2)
					{
						this.ProcessCommand(command2);
					}
					break;
				case "setsysredpoint":
					XSingleton<XGameSysMgr>.singleton.SetSysRedPointState((XSysDefine)int.Parse(array[1]), array[2] == "true");
					break;
				case "gyroon":
					XSingleton<XGyroscope>.singleton.Enabled = true;
					break;
				case "capture":
					XSingleton<UiUtility>.singleton.PandoraPicShare("", "", "UIRoot(Clone)/OperatingActivityDlg(Clone)/Bg/Right");
					break;
				case "AddMaquee":
					int num35 = 0;
					int.TryParse(array[1], out num35);
					for (int num36 = 0; num36 < num35; num36++)
					{
						//zcg DlgBase<XChatMaqueeView, XChatMaqueeBehaviour>.singleton.AddMaqueeNormalInfo(array[2], 0f);
					}
					break;
				case "openfc":
					//zcg DlgBase<ProfessionChangeDlg, ProfessionChangeBehaviour>.singleton.SetVisibleWithAnimation(true, null);
					break;
				case "removefiles":
					//zcg XSingleton<XChatIFlyMgr>.singleton.ClearAudioCache();
					break;
				case "level55":
					string[] array5 = new string[]
					{
						"level 55",
						"openallsystem",
						"star",
						"task finishall",
						"item 1 900000",
						"item 7 900000",
						"item 9997 1",
						"tutorialendall"
					};
					foreach (string command3 in array5)
					{
						this.ProcessCommand(command3);
					}
					break;
				default:
					result = SendGMCommandToServer(command);
					break;
			}
			return result;
			
		}

		public bool SendGMCommandToServer(string command)
		{
			RpcC2G_GMCommand rpcC2G_GMCommand2 = new RpcC2G_GMCommand();
			rpcC2G_GMCommand2.oArg.cmd = command;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GMCommand2);
			return true;
		}

		// Token: 0x0600C74F RID: 51023 RVA: 0x002C6C68 File Offset: 0x002C4E68
		public void SkillLearn(object o = null)
		{
			XSkillTreeDocument specificDocument = XDocuments.GetSpecificDocument<XSkillTreeDocument>(XSkillTreeDocument.uuID);
			bool flag = false;
			for (int i = 10; i <= 1000; i *= 10)
			{
				if ((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID < (ulong)((long)(i / 10)))
				{
					break;
				}
				int profID = (int)(XSingleton<XAttributeMgr>.singleton.XPlayerData.TypeID % (uint)i);
				List<uint> profSkillID = XSingleton<XSkillEffectMgr>.singleton.GetProfSkillID(profID);
				for (int j = 0; j < profSkillID.Count; j++)
				{
					if (specificDocument.CheckLevelUpButton(profSkillID[j]))
					{
						flag = true;
						RpcC2G_SkillLevelup rpcC2G_SkillLevelup = new RpcC2G_SkillLevelup();
						rpcC2G_SkillLevelup.oArg.skillHash = profSkillID[j];
						XSingleton<XClientNetwork>.singleton.Send(rpcC2G_SkillLevelup);
					}
				}
			}
			if (flag)
			{
				XSingleton<XTimerMgr>.singleton.SetTimer(0.2f, new XTimerMgr.ElapsedEventHandler(this.SkillLearn), null);
			}
			else
			{
				XSingleton<XDebug>.singleton.AddGreenLog("Learn All Skill End.", null, null, null, null, null);
			}
		}

		// Token: 0x0600C750 RID: 51024 RVA: 0x002C6D84 File Offset: 0x002C4F84
		public void GuildCollectNav(object o = null)
		{
			XSingleton<XTimerMgr>.singleton.KillTimer(this._timeToken);
			this._timeToken = XSingleton<XTimerMgr>.singleton.SetTimer(2f, new XTimerMgr.ElapsedEventHandler(this.GuildCollectNav), null);
			if (DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>.singleton.IsVisible())
			{
				XSingleton<XInput>.singleton.LastNpc = null;
			}
			else
			{
				if (XSingleton<XInput>.singleton.LastNpc == null)
				{
					this.NpcID -= 1U;
					if (this.NpcID < 97U)
					{
						this.NpcID = 100U;
					}
					XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(this.NpcID);
					if (npc != null)
					{
						XSingleton<XInput>.singleton.LastNpc = npc;
					}
				}
			}
		}

		// Token: 0x0600C751 RID: 51025 RVA: 0x002C6E41 File Offset: 0x002C5041
		public void ClearGuildCollectNav()
		{
			this.ProcessCommand("clearguildcollectCD");
			XSingleton<XInput>.singleton.LastNpc = null;
			XSingleton<XTimerMgr>.singleton.KillTimer(this._timeToken);
		}

		// Token: 0x0600C752 RID: 51026 RVA: 0x002C6E70 File Offset: 0x002C5070
		public void CustomCommand(int index)
		{
			string text = Path.Combine(Application.persistentDataPath, "GM.txt");
			FileInfo fileInfo = new FileInfo(text);
			if (fileInfo.Exists)
			{
				StreamReader streamReader;
				try
				{
					streamReader = new StreamReader(text, Encoding.Default);
				}
				catch (IOException ex)
				{
					Debug.Log(ex);
					XSingleton<XDebug>.singleton.AddErrorLog("读表失败，请关闭正在打开的表格重试", null, null, null, null, null);
					return;
				}
				bool flag = false;
				while (!streamReader.EndOfStream)
				{
					string text2 = streamReader.ReadLine();
					if (text2.Length >= 2)
					{
						if (text2[0] == '$')
						{
							flag = ((int)text2[1] == 48 + index);
							continue;
						}
					}
					if (flag)
					{
						this.ProcessCommand(text2);
					}
				}
				streamReader.Close();
			}
		}

		// Token: 0x0400578B RID: 22411
		private GameObject terrain = null;

		// Token: 0x0400578C RID: 22412
		private uint _timeToken;

		// Token: 0x0400578D RID: 22413
		private uint NpcID = 97U;
	}
}
